﻿<?php
error_reporting(0);
define('IN_QY',true);
session_start();
require("include/common.inc.php");
define('SCRIPT','ad_list');
//
if(!$_COOKIE['userid']){
      echo "<script type='text/javascript'>location.href='/wap/mlogin.php';</script>";
      exit;
}

?>

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>快递选择-众晒网</title>
    <link rel="stylesheet" type="text/css" href="/ui/css/Hui.css" />
    <style type="text/css">
    body#body {
    height: 100%;
}
    .H-theme-background-color9 {
    background-color: #ffffff;
}
.H-theme-font-color-white {
    color: black;
}
.H-theme-border-color9 {
    border: 1px solid #ffa200;
}
.H-theme-font-color9 {
    color: #ffa200;
}
input.H-textbox.H-vertical-align-middle.H-vertical-middle.H-font-size-16.H-flex-item.H-box-sizing-border-box.H-border-none.H-outline-none.H-padding-12{
    background-color: #ffffff00;
    border: 1px solid #bbbbbb;
    border-radius: 5px;
    margin-right: 20px;
    line-height: 15px;
}
.H-theme-background-color-white {
    background-color: #ffffff00;
}
.H-theme-background-color1 {
    background-color: #FF6533;
}
.H-theme-border-color1 {
    border:0;
}
    a {
    width: 50px;
}

    </style>
</head>
<body id="body">
    <header class="H-header H-theme-background-color9" id="header">
        <span tapmode="" onclick="H.closeWin();" class="H-icon H-position-relative H-display-inline-block H-float-left H-vertical-middle H-theme-font-color-white H-padding-horizontal-left-5 H-z-index-100"><i class="H-iconfont H-icon-arrow-left H-font-size-18 H-vertical-middle"></i><label class="H-display-block H-vertical-middle H-font-size-15">返回</label></span>
        <div class="H-header-title H-center-all H-font-size-18 H-text-show-row-1 H-theme-font-color-white H-position-absolute H-width-100-percent">
            快递选择
        </div>
    </header>

	
	<div class="H-flexbox-horizontal H-margin-vertical-bottom-10">
        <span class="H-vertical-middle H-padding-horizontal-left-10 H-theme-background-color-white H-font-size-16">选择快递：</span>
        <select name="yourName" id="delivery_com">
            <option value="0">请选择</option>
            <option value="sto">申通快递</option>
            <option value="yt">圆通快递</option>
            <option value="sf">顺丰快递</option>
            <option value="tt">天天快递</option>
            <option value="yd">韵达快递</option>
            <option value="zto">中通快递</option>
            <option value="ems">EMS</option>			
        </select>
    </div>
    <div class="H-flexbox-horizontal H-margin-vertical-bottom-10">
        <span class="H-vertical-middle H-padding-horizontal-left-10 H-theme-background-color-white H-font-size-16">首重费用：</span><input type="text" class="H-textbox H-vertical-align-middle H-vertical-middle H-font-size-16 H-flex-item H-box-sizing-border-box H-border-none H-outline-none H-padding-12" placeholder="首重费用" id="first_weight_money">
    </div>
    <div class="H-flexbox-horizontal H-margin-vertical-bottom-10">
        <span class="H-vertical-middle H-padding-horizontal-left-10 H-theme-background-color-white H-font-size-16">首重（kg）：</span><input type="text" class="H-textbox H-vertical-align-middle H-vertical-middle H-font-size-16 H-flex-item H-box-sizing-border-box H-border-none H-outline-none H-padding-12" id="first_weight">
    </div>
    <div class="H-flexbox-horizontal H-margin-vertical-bottom-10">
        <span class="H-vertical-middle H-padding-horizontal-left-10 H-theme-background-color-white H-font-size-16">续重费用：</span><input type="text" class="H-textbox H-vertical-align-middle H-vertical-middle H-font-size-16 H-flex-item H-box-sizing-border-box H-border-none H-outline-none H-padding-12" placeholder="续重费用" id="extend_weight_money">
    </div>
    <div class="H-flexbox-horizontal H-margin-vertical-bottom-10">
        <span class="H-vertical-middle H-padding-horizontal-left-10 H-theme-background-color-white H-font-size-16">续重（kg）：</span><input type="text" class="H-textbox H-vertical-align-middle H-vertical-middle H-font-size-16 H-flex-item H-box-sizing-border-box H-border-none H-outline-none H-padding-12" id="extend_weight_unit">
    </div>
	<button type="button" onclick="add()" class="H-button H-width-100-percent  H-font-size-15 H-outline-none H-padding-vertical-both-12 H-padding-horizontal-both-20 H-theme-background-color1 H-theme-font-color-white H-theme-border-color1 H-theme-border-color1-click H-theme-background-color1-click H-theme-font-color1-click H-border-radius-3" style="color: white;margin-left: 12%;width: 75%;font-weight: 600;
    ">立即提交</button>
    <br>
    <span style="font-size: 8px; color: #bbbbbb;margin-left: 10px;">*运费规则:商品运费=首重费用+((商品重量-首重)/续重)*续重费用</span>
   <script type="text/javascript" src="/ui/script/H.js"></script>
	<script src="/ui/js/jquery-1.9.1.min.js"></script>
 
    <script type="text/javascript" src="/ui/layer/mobile/layer.js"></script> 
	
	<script>
	
	function add(){
	
		var businessuid= '<?=$_COOKIE['userid']?>';

		var deliverycom= $('#delivery_com option:selected').text();
		var deliverycomcode= $('#delivery_com option:selected') .val();
		
		
		var firstweight= document.getElementById("first_weight").value;
		var firstweightmoney= document.getElementById("first_weight_money").value;
		var extendweightunit= document.getElementById("extend_weight_unit").value;
		var extendweightmoney= document.getElementById("extend_weight_money").value;		
	
	console.log(businessuid);
	console.log(deliverycom);
	console.log(deliverycomcode);
	console.log(firstweight);
	console.log(firstweightmoney);
	console.log(extendweightunit);
	console.log(extendweightmoney);
	if(deliverycomcode=="0"){
	layer.open({
    content: '请选择快递公司'
    ,skin: 'msg'
    ,time: 2 
  });
 	return false; 
	}

	if(deliverycomcode==""){
	layer.open({
    content: '快递公司代码错误'
    ,skin: 'msg'
    ,time: 2 
  });
 	return false; 
	}
	
	if(firstweightmoney==""){
	layer.open({
    content: '请填写首重费用'
    ,skin: 'msg'
    ,time: 2 
  });
 	return false; 
	}
	
	if(firstweight==""){
	layer.open({
    content: '请填写首重kg'
    ,skin: 'msg'
    ,time: 2 
  });
 	return false; 
	}
	
	if(extendweightmoney==""){
	layer.open({
    content: '请填写续重费用'
    ,skin: 'msg'
    ,time: 2 
  });
 	return false; 
	}
	
	if(extendweightunit==""){
	layer.open({
    content: '请填写续重kg'
    ,skin: 'msg'
    ,time: 2 
  });
 	return false; 
	}	
	
	                                $.ajax({
                                        url: '/api/muyin/api.php?s=user.set_business_delivery',
                                        type: 'POST',
                                        dataType: 'json',
                                        data: {businessuid: businessuid,
										delivery_com: deliverycom,
										delivery_com_code: deliverycomcode,
										first_weight: firstweight,
										first_weight_money: firstweightmoney,
										extend_weight_unit: extendweightunit,
										extend_weight_money: extendweightmoney   										
										},
                                      })
									  
                                      .done(function(respon) {
                                        if (respon.code==0) {
                                       layer.open({
                                       content: '设置成功'
                                      ,btn: ['知道了']
                                      ,yes: function(index){
                                      window.location.href="index.php";
                                     layer.close(index);
                                        }
                                        });
                                      
									  
                                        }else{
                                             layer.open({
                                             content: '请先输入完成后再提交！'
                                             ,skin: 'msg'
                                              ,time: 2 //2秒后自动关闭
                                                }); 
                                        
                                        }
                                      })

	
	}
	</script>

</body>
</html>